<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var isSubsequence = function (s, t) {
        let short = 0;
        let long = 0;
        let tArr = t.split("");
        let sArr = s.split("");

        while (sArr[long]) {
          if (sArr[short] === sArr[long]) {
            short++;
          }
          long++;
        }
        if (short === sArr.length) return true;
        return false;
      };

      console.log(isSubsequence("abc", "ahbgdc")); 
    </script>
  </body>
</html>
